1include <BOSL2/std.scad>
2
3$fn = 45;
4wire_d = 2;
5spring_l = 100;
6spring_d = 20;
7rod_d = 10;
8loops = 17;
9tight_loops=3;
10
11tpart = tight_loops/loops;
12lpart = wire_d * tight_loops / 100;
13r_table = [
14 [0.00, 0],
15 [0+tpart, 0],
16 [0.5, 1],
17 [1-tpart, 0],
18 [1.00, 0],
19];
20l_table = [
21 [0.00, -0.50],
22 [0+tpart, -0.5+lpart],
23 [1-tpart, +0.5-lpart],
24 [1.00, +0.50],
25];
26lsteps = 45;
27tsteps = loops * lsteps;
28path = [
29 for (i = [0:1:tsteps])
30 let(
31 u = i / tsteps,
32 a = u * 360 * loops,
33 r = lookup(u, r_table) * spring_d/2 + wire_d/2 + rod_d/2,
34 z = lookup(u, l_table) * spring_l,
35 pt = [r*cos(a), r*sin(a), z]
36 ) pt
37];
38yrot(90) {
39 color("lightblue")
40 path_sweep(circle(d=wire_d), path);
41 cylinder(d=rod_d, h=spring_l+10, center=true);
42}
43
44
45// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap